version: "3"

services:
  db:
    image: postgres:16.3
    env_file: .env
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"

  redis:
    image: redis:7.2.4
    volumes:
      - redis_data:/data
    ports:
      - "6379:6379"

  bot:
    build: ./bot
    env_file: .env
    depends_on:
      - redis

  backend:
    build: ./backend
    env_file: .env
    depends_on:
      - db

  nginx:
    build: ./nginx
    environment:
      - PORT=${PORT}
    depends_on:
      - backend
    ports:
      - "${PORT}:${PORT}"

volumes:
  postgres_data:
  redis_data:
